package com.client.controller;

import com.client.pojo.ForumLikes;
import com.client.service.ForumLikesService;
import com.client.utils.ResponseMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 帖子点赞表 前端控制器
 * </p>
 *
 * @author ckick
 * @since 2025-09-20 08:28:54
 */
@RestController
@RequestMapping("/forumLikes")
public class ForumLikesController {
    @Autowired
    private ForumLikesService forumLikesService;

    /**
     * 根据用户id查询帖子点赞历史
     * @param userId 用户id
     * @return 帖子点赞历史
     */
    @GetMapping("getLike/{userId}")
    public ResponseMsg getLike(@PathVariable Integer userId){
        List<ForumLikes> forumLikes = forumLikesService.getEntryByIds(userId);
        if(forumLikes == null){
            return ResponseMsg.getInstance(ResponseMsg.ERROR,"暂无点赞历史~");
        }
        return ResponseMsg.getInstance(ResponseMsg.SUCCESS,"查询点赞历史~",forumLikes);
    }
}
